//生成路由表和路由器，配置路由相关信息
import {createRouter,createWebHistory} from 'vue-router'
import OrderTab from '@/views/OrderTab.vue'
import ProductTab from '@/views/ProductTab.vue'
import UserTab from '@/views/UserTab.vue'
import ProductDetails from '@/views/ProductDetails.vue'
//路由器（router）
//路由：就从哪里来 到哪里去（重点那哪里去）
//路由--》路由表--》路由器

//路由表
const route =[
    {
        path:"/order",
        name:"order",
        component:OrderTab
    },
    {
        path:"/product",
        name:"product",
        component:ProductTab,
        children:[
            {
            path:"details/:id?/:title?",
            name:"details",
            component:ProductDetails,
            } 
        ]
    },
    {
        path:"/user",
        name:"user",
        component:UserTab
    }
]

//创建路由器
const router= createRouter({
    history:createWebHistory(),
    routes:route
})

export default router